import requests
import config

def get_verity_code():
    return requests.get(url=f"{config.BASE_URL}/api/captchaImage")
def login(username,password,uuid,code="2"):
    url= config.BASE_URL + "/api/login"
    json_data = {
        "username": username,
        "password": password,
        "code": code,
        "uuid": uuid
    }
    return requests.post(url=url, json=json_data)

if __name__ == '__main__':
    uuid=get_verity_code().json().get("uuid")
    print(login("admin","HM_2023_test",uuid).text)
    uuid = get_verity_code().json().get("uuid")
    print(login("admin","HM_2023_test",uuid).json().get("token"))